<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
    
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>编译错误信息 - MasterOJ</title>
        <?php require( "./template/bshark/header-files.php");?>
    </head>
    
    <body>
        <?php require( "./template/bshark/nav.php");?>
        <div class="card" style="margin: 3% 8% 5% 8%">
            <div class="card-body">
                <h4>编译错误信息</h4>
                <div class="card" style="box-shadow:0px 3px 3px #ddd;"><div class="card-body"><pre><code><?php echo $view_reinfo?></code></pre></div></div>
                <span style="display:none" id="errtxt"><?php echo $view_reinfo;?></span><br>
                <button class="btn btn-outline-dark" onclick="explain();this.style.display='none';">显示辅助信息</button>
                <div id='errexp'></div>
                <script>
var i=0;
var pats=new Array();
var exps=new Array();
pats[i]=/System\.out\.print.*%.*/;
exps[i++]="<?php echo $MSG_SYSTEM_OUT_PRINT; ?>";
pats[i]=/.*没有那个文件或目录.*/;
exps[i++]="<?php echo $MSG_NO_SUCH_FILE_OR_DIRECTORY; ?>";
pats[i]=/not a statement/;
exps[i++]="<?php echo $MSG_NOT_A_STATEMENT; ?>";
pats[i]=/class, interface, or enum expected/;
exps[i++]="<?php echo $MSG_EXPECTED_CLASS_INTERFACE_ENUM; ?>";
pats[i]=/asm.*java/;
exps[i++]="<?php echo $MSG_SUBMIT_JAVA_AS_C_LANG; ?>";
pats[i]=/package .* does not exist/;
exps[i++]="<?php echo $MSG_DOES_NOT_EXIST_PACKAGE; ?>";
pats[i]=/possible loss of precision/;
exps[i++]="<?php echo $MSG_POSSIBLE_LOSS_OF_PRECISION; ?>";
pats[i]=/incompatible types/;
exps[i++]="<?php echo $MSG_INCOMPATIBLE_TYPES; ?>";
pats[i]=/illegal start of expression/;
exps[i++]="<?php echo $MSG_ILLEGAL_START_OF_EXPRESSION; ?>";
pats[i]=/cannot find symbol/;
exps[i++]="<?php echo $MSG_CANNOT_FIND_SYMBOL; ?>";
pats[i]=/';' expected/;
exps[i++]="<?php echo $MSG_EXPECTED_SEMICOLON; ?>";
pats[i]=/should be declared in a file named/;
exps[i++]="<?php echo $MSG_DECLARED_JAVA_FILE_NAMED; ?>";
pats[i]=/expected ‘.*’ at end of input/;
exps[i++]="<?php echo $MSG_EXPECTED_WILDCARD_CHARACTER_AT_END_OF_INPUT; ?>";
pats[i]=/invalid conversion from ‘.*’ to ‘.*’/;
exps[i++]="<?php echo $MSG_INVALID_CONVERSION; ?>";
pats[i]=/warning.*declaration of 'main' with no type/;
exps[i++]="<?php echo $MSG_NO_RETURN_TYPE_IN_MAIN; ?>";
pats[i]=/'.*' was not declared in this scope/;
exps[i++]="<?php echo $MSG_NOT_DECLARED_IN_SCOPE; ?>";
pats[i]=/main’ must return ‘int’/;
exps[i++]="<?php echo $MSG_MAIN_MUST_RETURN_INT; ?>";
pats[i]=/expected identifier or '\(' before numeric constant/
exps[i++]="<?php echo $MSG_EXPECTED_IDENTIFIER; ?>";
pats[i]=/printf.*was not declared in this scope/;
exps[i++]="<?php echo $MSG_PRINTF_NOT_DECLARED_IN_SCOPE; ?>";
pats[i]=/warning: ignoring return value of/;
exps[i++]="<?php echo $MSG_IGNOREING_RETURN_VALUE; ?>";
pats[i]=/:.*__int64’ undeclared/;
exps[i++]="<?php echo $MSG_NOT_DECLARED_INT64; ?>";
pats[i]=/:.*expected ‘;’ before/;
exps[i++]="<?php echo $MSG_EXPECTED_SEMICOLON_BEFORE; ?>";
pats[i]=/ .* undeclared \(first use in this function\)/;
exps[i++]="<?php echo $MSG_UNDECLARED_NAME; ?>";
pats[i]=/scanf.*was not declared in this scope/;
exps[i++]="<?php echo $MSG_SCANF_NOT_DECLARED_IN_SCOPE; ?>";
pats[i]=/memset.*was not declared in this scope/;
exps[i++]="<?php echo $MSG_MEMSET_NOT_DECLARED_IN_SCOPE; ?>";
pats[i]=/malloc.*was not declared in this scope/;
exps[i++]="<?php echo $MSG_MALLOC_NOT_DECLARED_IN_SCOPE; ?>";
pats[i]=/puts.*was not declared in this scope/;
exps[i++]="<?php echo $MSG_PUTS_NOT_DECLARED_IN_SCOPE; ?>";
pats[i]=/gets.*was not declared in this scope/;
exps[i++]="<?php echo $MSG_GETS_NOT_DECLARED_IN_SCOPE; ?>";
pats[i]=/str.*was not declared in this scope/;
exps[i++]="<?php echo $MSG_STRING_NOT_DECLARED_IN_SCOPE; ?>";
pats[i]=/‘import’ does not name a type/;
exps[i++]="<?php echo $MSG_NO_TYPE_IMPORT_IN_C_CPP; ?>";
pats[i]=/asm’ undeclared/;
exps[i++]="<?php echo $MSG_ASM_UNDECLARED; ?>";
pats[i]=/redefinition of/;
exps[i++]="<?php echo $MSG_REDEFINITION_OF; ?>";
pats[i]=/expected declaration or statement at end of input/;
exps[i++]="<?php echo $MSG_EXPECTED_DECLARATION_OR_STATEMENT; ?>";
pats[i]=/warning: unused variable/;
exps[i++]="<?php echo $MSG_UNUSED_VARIABLE; ?>";
pats[i]=/implicit declaration of function/;
exps[i++]="<?php echo $MSG_IMPLICIT_DECLARTION_OF_FUNCTION; ?>";
pats[i]=/too .* arguments to function/;
exps[i++]="<?php echo $MSG_ARGUMENTS_ERROR_IN_FUNCTION; ?>";
pats[i]=/expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘namespace’/;
exps[i++]="<?php echo $MSG_EXPECTED_BEFORE_NAMESPACE; ?>";
pats[i]=/stray ‘\\[0123456789]*’ in program/;
exps[i++]="<?php echo $MSG_STRAY_PROGRAM; ?>";
pats[i]=/division by zero/;
exps[i++]="<?php echo $MSG_DIVISION_BY_ZERO; ?>";
pats[i]=/cannot be used as a function/;
exps[i++]="<?php echo $MSG_CANNOT_BE_USED_AS_A_FUNCTION; ?>";
pats[i]=/format .* expects type .* but argument .* has type .*/;
exps[i++]="<?php echo $MSG_CANNOT_FIND_TYPE; ?>";
pats[i]=/类.*是公共的，应在名为 .*java 的文件中声明/;
exps[i++]="<?php echo $MSG_JAVA_CLASS_ERROR; ?>";
pats[i]=/expected ‘\)’ before ‘.*’ token/;
exps[i++]="<?php echo $MSG_EXPECTED_BRACKETS_TOKEN; ?>";
pats[i]=/找不到符号/;
exps[i++]="<?php echo $MSG_NOT_FOUND_SYMBOL; ?>";
pats[i]=/需要为 class、interface 或 enum/;
exps[i++]="<?php echo $MSG_NEED_CLASS_INTERFACE_ENUM; ?>";
pats[i]=/符号： 类 .*List/;
exps[i++]="<?php echo $MSG_CLASS_SYMBOL_ERROR; ?>";
pats[i]=/方法声明无效；需要返回类型/;
exps[i++]="<?php echo $MSG_INVALID_METHOD_DECLARATION; ?>";
pats[i]=/expected.*before.*&.*token/;
exps[i++]="<?php echo $MSG_EXPECTED_AMPERSAND_TOKEN; ?>";
pats[i]=/非法的表达式开始/;
exps[i++]="<?php echo $MSG_DECLARED_FUNCTION_ORDER; ?>";
pats[i]=/需要 ';'/;
exps[i++]="<?php echo $MSG_NEED_SEMICOLON; ?>";
pats[i]=/extra tokens at end of #include directive/;
exps[i++]="<?php echo $MSG_EXTRA_TOKEN_AT_END_OF_INCLUDE; ?>";
pats[i]=/int.*hasNext/;
exps[i++]="<?php echo $MSG_INT_HAS_NEXT; ?>";
pats[i]=/unterminated comment/;
exps[i++]="<?php echo $MSG_UNTERMINATED_COMMENT; ?>";
pats[i]=/expected '=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token/;
exps[i++]="<?php echo $MSG_EXPECTED_BRACES_TOKEN; ?>";
pats[i]=/进行语法解析时已到达文件结尾/;
exps[i++]="<?php echo $MSG_REACHED_END_OF_FILE_1; ?>";
pats[i]=/subscripted value is neither array nor pointer/;
exps[i++]="<?php echo $MSG_SUBSCRIPT_ERROR; ?>";
pats[i]=/expected expression before ‘%’ token/;
exps[i++]="<?php echo $MSG_EXPECTED_PERCENT_TOKEN; ?>";
pats[i]=/expected expression before ‘.*’ token/;
exps[i++]="<?php echo $MSG_EXPECTED_EXPRESSION_TOKEN; ?>";
pats[i]=/expected but/;
exps[i++]="<?php echo $MSG_EXPECTED_BUT; ?>";
pats[i]=/redefinition of ‘main’/;
exps[i++]="<?php echo $MSG_REDEFINITION_MAIN; ?>";
pats[i]=/iostream: No such file or directory/;
exps[i++]="<?php echo $MSG_IOSTREAM_ERROR; ?>";
pats[i]=/expected unqualified-id before ‘\[’ token/;
exps[i++]="<?php echo $MSG_EXPECTED_UNQUALIFIED_ID_TOKEN; ?>";
pats[i]=/解析时已到达文件结尾/;
exps[i++]="<?php echo $MSG_REACHED_END_OF_FILE_2; ?>";
pats[i]=/非法字符/;
exps[i++]="<?php echo $MSG_INVALID_SYMBOL; ?>";
pats[i]=/应在名为.*的文件中声明/;
exps[i++]="<?php echo $MSG_DECLARED_FILE_NAMED; ?>";
pats[i]=/variably modified/;
exps[i++]="<?php echo $MSG_VARIABLY_MODIFIED; ?>";

function explain(){
//alert("asdf");
//var errmsg=$("#errtxt").text();
var errmsg = document.getElementById("errtxt").innerHTML;
//var errmsg='';
var expmsg="<h5>辅助解释</h5><hr>";
for(var i=0;i<pats.length;i++){
var pat=pats[i];
var exp=exps[i];
var ret=pat.exec(errmsg);
if(ret){
expmsg+=ret+":"+exp+"<br><br>";
}
}
document.getElementById("errexp").innerHTML=expmsg;
//alert(expmsg);
}
</script>
            </div>
        </div>
        <?php require( "./template/bshark/footer.php");?>
        <?php require( "./template/bshark/footer-files.php");?>
    </body>

</html>